import store from "./../vuex"
let login = resolve => require(['./../views/login.vue'], resolve)
// let home = resolve => require(['./../views/home.vue'], resolve)
let vod = resolve => require(['./../views/sys/vod.vue'], resolve)
let livevideo = resolve => require(['../views/sys/livevideo.vue'], resolve)
let main = resolve => require(['./../views/sys/hello'], resolve)
let history = resolve => require(['./../views/sys/history'], resolve)
let notFound = resolve => require(['./../views/404'], resolve)
let organizationManage = resolve => require(['./../views/sys/organizationManage'], resolve)
let userManage = resolve => require(['./../views/sys/userManage'], resolve)
let role = resolve => require(['./../views/sys/role'], resolve)
let resource = resolve => require(['./../views/sys/resource'], resolve)
let logs = resolve => require(['./../views/sys/logs'], resolve)
let statisticsUser = resolve => require(['../views/sys/statisticsUser'], resolve)
let statisticsVideo = resolve => require(['../views/sys/statisticsVideo'], resolve)
let statisticsLive = resolve => require(['../views/sys/statisticsLive'], resolve)
let statisticsOrg = resolve => require(['../views/sys/statisticsOrg'], resolve)
let statisticsStore = resolve => require(['../views/sys/statisticsStore'], resolve)
let bulletin = resolve => require(['./../views/sys/bulletin'], resolve)
let userM = resolve => require(['./../views/sys/userM'], resolve)
let dept = resolve => require(['./../views/sys/dept'], resolve)
let liveManage = resolve => require(['./../views/sys/liveManage'], resolve)
let vodManage = resolve => require(['./../views/sys/vodManage'], resolve)
let echarts = resolve => require(['./../views/echarts'], resolve)

let routers = [
  {
    path: '/login',
    name: 'login',
    component: login,
    hidden: true,
    beforeEnter: (to, from, next) => {
      if (store.state.isLogin) {
        next('/')
      } else {
        next()
      }
    }
  },
  {
    path: '/',
    component: echarts,
    name: '首页',
    iconCls: 'stats-bars',
  },

  {path: '/main', component: main, name: '主页', hidden: true},
  {path: '/vod', component: vod, name: '点播频道'},
  {path: '/livevideo', component: livevideo, name: '直播频道'},
  {path: '/history', component: history, name: '观看历史'},

  {path: '/organizationManage', component: organizationManage, name: '单位管理'},
  {path: '/userManage', component: userManage, name: '用户管理'},
  {path: '/role', component: role, name: '角色管理'},
  {path: '/resource', component: resource, name: '资源管理'},
  {path: '/logs', component: logs, name: '操作日志'},

  // {path: '/dashboard', component: dashboard, name: '综合分析'},
  {path: '/statisticsStore', component: statisticsStore, name: '存储空间'},
  {path: '/statisticsOrg', component: statisticsOrg, name: '单位统计'},
  {path: '/statisticsUser', component: statisticsUser, name: '人员统计'},
  {path: '/statisticsVideo', component: statisticsVideo, name: '视频统计'},
  {path: '/statisticsLive', component: statisticsLive, name: '直播统计'},

  {path: '/bulletin', component: bulletin, name: '公告管理'},
  {path: '/userM', component: userM, name: '人员管理'},
  {path: '/dept', component: dept, name: '部门管理'},
  {path: '/liveManage', component: liveManage, name: '直播频道管理'},
  {path: '/vodManage', component: vodManage, name: '点播资源管理'},
  {
    path: '/404',
    component: notFound,
    name: '',
    hidden: true
  },
  {
    path: '*',
    hidden: true,
    redirect: {path: '/'}
  }
]

export default routers
